package com.wc.alorithm_luogu.P2676;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @Author congge
 * @Date 2023/5/13 15:38
 * @description https://www.luogu.com.cn/problem/P2676
 * [USACO07DEC]Bookshelf B
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        int b = sc.nextInt();
        int[] array = new int[n];

        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
        }

        Arrays.sort(array);

        int sum = 0;
        int ans = 0;
        for (int i = n - 1; i >= 0; i--) {
            sum += array[i];
            ans++;
            if (sum >= b) {
                break;
            }
        }
        System.out.println(ans);
    }
}
